package com.yc.dygang.web;

import com.google.gson.Gson;
import com.yc.common.util.DBHelper;
import com.yc.dygang.dao.CategoryDao;
import com.yc.dygang.util.Util;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;

@WebServlet(name = "QueryCategoryServlet", value = "/QueryCategoryServlet")
public class QueryCategoryServlet extends HttpServlet {

    private CategoryDao categoryDao = new CategoryDao();

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String id = request.getParameter("id");
        if (id==null){
            return;
        }else {
            Map<String, Object> map = categoryDao.queryCategory(id);
            Util.toJson(map, response);
        }
    }

}
